package com.example.wechat114.service.impl;

import com.example.wechat114.commons.JsonBean;
import com.example.wechat114.entity.Registered;
import com.example.wechat114.mapper.RegisteredMapper;
import com.example.wechat114.service.RegisteredService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static javafx.scene.input.KeyCode.J;

/**
 * @author 张超杰
 * @company 张超杰
 * @create 2021-11-25 15:39
 */
@Service
public class RegisteredServiceImpl implements RegisteredService {
    @Autowired
    private RegisteredMapper registeredMapper;

    @Override
    public JsonBean addRegisteredService(Registered registered) {
        registered.setStatus("0");
        JsonBean jsonBean = new JsonBean(-1, "添加失败",null);
        int i = registeredMapper.insertSelective(registered);
        if(i>0){
             jsonBean = new JsonBean(0, "添加成功",null);

        }
        return jsonBean;
    }

    @Override
    public JsonBean getRegistered(String phon) {
        return new JsonBean(0,"",registeredMapper.getRegistered(phon));
    }

    @Override
    public JsonBean getRegisteredByid(Integer id) {
        return new JsonBean(0,"",registeredMapper.getRegisteredByid(id));
    }
}
